cmake_minimum_required(VERSION 3.14)
set(CMAKE_BUILD_TYPE Debug)
project(Anatof)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# 查找 ROOT 包
find_package(ROOT REQUIRED Core Tree RIO Hist Gui Gpad Graf Graf3d Gpad)
find_package(yaml-cpp REQUIRED)
include_directories(./inc)
# 包含头文件目录
include_directories(${ROOT_INCLUDE_DIRS})
# include_directories(../../../DataClass)

# 搜索所有 .cpp 文件
file(GLOB SOURCES "src/*.cpp")

# 遍历所有源文件，创建相应的可执行文件
foreach(SOURCE_FILE ${SOURCES})
    # 获取文件名（不带路径和扩展名）
    get_filename_component(EXEC_NAME ${SOURCE_FILE} NAME_WE)
    
    # 创建可执行文件
    add_executable(${EXEC_NAME} ${SOURCE_FILE})
    
    # 链接 ROOT 库
    target_link_libraries(${EXEC_NAME} ROOT::Core ROOT::Tree ROOT::Hist ROOT::Gpad yaml-cpp)
    
endforeach()

